package android.demo.activity.list;

import java.util.ArrayList;
import java.util.List;

import android.demo.BaseActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class ListActivityA extends BaseActivity {

	List<String> data;
	
	{
	    data = new ArrayList<String>();
	    data.add("测试数据1");
	    data.add("测试数据2");
	    data.add("测试数据3");
	    data.add("测试数据4");
    }
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		ListView mListView = new ListView(this);  
//		android.R.layout.simple_expandable_list_item_1
		ArrayAdapter<String> adapter = 
			new ArrayAdapter<String>(this,
				android.R.layout.simple_list_item_checked,  
				data
		);  
		mListView.setAdapter(adapter);  
		
		mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
				setTitle("You Click Item:" + String.valueOf(position));   
			}
		});
		
		setContentView(mListView); 
	}
}
